//
//  CreditElementViewContrller.m
//  PacIsBack
//
//  Created by Simon André on 08/02/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "CreditElementViewContrller.h"
#import "Constants.h"


@implementation CreditElementViewContrller

@synthesize nameView, referenceView;

/*
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
        // Custom initialization
    }
    return self;
}
*/

-(id) initWithName:(NSString*) name andReference:(NSString*) reference{
	if (self = [super init]) {
		UIView* emptyView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, iphoneWidth, textHeight)];
		[self setView:emptyView];
		[emptyView release];
		UITextView* tmpNameView = [[UITextView alloc] initWithFrame:CGRectMake(0.0, 0.0, iphoneHalfWidth, textHeight)];
		[tmpNameView setEditable:NO];
		[tmpNameView setScrollEnabled:NO];
		[tmpNameView setText:name];
		[tmpNameView setTextAlignment:UITextAlignmentRight];
		[tmpNameView setFont:[UIFont fontWithName:@"Courier-Bold" size:12.0]];
		[self setNameView:tmpNameView];
		[tmpNameView release];
		[[self view] addSubview:[self nameView]];
		UITextView* tmpReferenceView = [[UITextView alloc] initWithFrame:CGRectMake(iphoneHalfWidth, 0.0, iphoneHalfWidth, textHeight)];
		[tmpReferenceView setEditable:NO];
		[tmpReferenceView setScrollEnabled:NO];
		[tmpReferenceView setText:reference];
		[tmpReferenceView setTextAlignment:UITextAlignmentLeft];
		[tmpReferenceView setFont:[UIFont fontWithName:@"Courier" size:12.0]];
		[self setReferenceView:tmpReferenceView];
		[tmpReferenceView release];
		[[self view] addSubview:[self referenceView]];
	}
	return self;
}

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/

/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
}
*/

/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
}


- (void)dealloc {
	[self setNameView:nil];
	[self setReferenceView:nil];
	[super dealloc];
}


@end
